//
//  MidView.m
//  kyMusicPlayer
//
//  Created by 翁科宇 on 2018/5/17.
//  Copyright © 2018年 翁科宇. All rights reserved.
//

#import "MidView.h"

@implementation MidView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    self.delegate = self;
    self.showsHorizontalScrollIndicator = NO;
    self.pagingEnabled = YES;
    self.contentSize = CGSizeMake(ScreenWith * 2, 0);
    // 专辑图片视图配置
    _midIconView = [[IconView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, frame.size.height)];
    [self addSubview:_midIconView];
    
    //歌词视图配置
    _midLrcView = [[LrcTableView alloc] initWithStyle:UITableViewStylePlain];
    [_midLrcView KY_SetUpLrcTableViewFrame:CGRectMake(ScreenWith, 0, frame.size.width, frame.size.height)];
    _midLrcView.tableView.allowsSelection = NO;
    _midLrcView.tableView.backgroundColor = [UIColor clearColor];
    _midLrcView.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _midLrcView.tableView.showsVerticalScrollIndicator = NO;
    _midLrcView.tableView.contentInset = UIEdgeInsetsMake(frame.size.height / 2, 0, frame.size.height / 2, 0);
    [self addSubview:_midLrcView.view];
    return self;
}



- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    double spread = self.contentOffset.x / ScreenWith;
    _midIconView.alpha = 1.0 - spread;
    _midLrcView.tableView.alpha = spread;
}
@end
